public class Demo12 {
    public static volatile boolean isQuit = false;
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            System.out.println("你正在转账");
           while (!isQuit) {
               try {
                   Thread.sleep(3000);
               } catch (InterruptedException e) {
                   e.printStackTrace();
               }
           }
            System.out.println("你停止了转账");
        });

        System.out.println("老板喊你开始转账");
        t1.start();
        Thread.sleep(2000);
        System.out.println("老板发现对方是骗子，打电话通知你");
        isQuit = true;
    }
}
